home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / After Dark / ScreenFlip 1.5 / Source / AD Shared Resources / GraphicsModule.c < prev    next >
Text File  |  1995-11-10  |  2KB  |  79 lines

  1. /*
  2.     GraphicsModule.c -- adapted from original by Leo Breebaart.
  3.     
  4.     CodeWarior version.
  5.     
  6.     This file provides a generic interface for writing a After Dark™ graphics module.
  7.     The function "main" is called by After Dark and passed four parameters:
  8.     
  9.         storage:    A Handle to memory you have allocated.
  10.         blankRgn:    A region covering all screens.
  11.         message:    A value indicating which function to call.
  12.         params:        A pointer to a structure containing useful information.
  13.         
  14.     To use it, write the five routines:
  15.     
  16.     OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
  17.     OSErr DoClose(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  18.     OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  19.     OSErr DoDrawFrame(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  20.     OSErr DoSetUp(RgnHandle blankRgn, short message, GMParamBlockPtr params);
  21.     
  22.     For more information, consult the programmer's section of the manual.
  23.     
  24.     The following people are all conspirators in this code:
  25.         Patrick Beard
  26.         Bruce Burkhalter
  27.         Colin Glassey
  28.         Andrew Armstrong
  29.     
  30.     ©1989-1995 Berkeley Systems, Inc.
  31.  */
  32.  
  33. #include "GraphicsModule_Types.h"
  34. #include "ModuleFunctions.h"
  35.  
  36. pascal OSErr
  37. main (Handle *storage, RgnHandle blankRgn, short message, GMParamBlockPtr params)
  38. {
  39.     OSErr err = noErr;
  40.     
  41.         /* dispatch message to appropriate routine. */
  42.                 
  43.     switch(message)
  44.     {
  45.         case Initialize:
  46.             err = DoInitialize(storage, params);
  47.             break;
  48.         
  49.         case Close:
  50.             err = DoClose(*storage, blankRgn, params);
  51.             break;
  52.         
  53.         case Blank:
  54.             err = DoBlank(*storage, blankRgn, params);
  55.             break;
  56.             
  57.         case DrawFrame:
  58.             err = DoDrawFrame(*storage, params);
  59.             break;
  60.         
  61.         case ModuleSelected:
  62.             err = DoModuleSelected(params);
  63.             break;
  64.             
  65.         case DoAbout:
  66.             //SysBeep(2); SysBeep(2); Delay(180, &dummy);
  67.             err = DoAboutBox(params);
  68.             break;
  69.  
  70.             /* Check to see if the user pressed a button. */
  71.         default:    
  72.             if (message >= ButtonMessage)
  73.                 err = DoButton(message, params);
  74.             break;
  75.     }
  76.     
  77.     return err;
  78. }
  79.